<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>附件页</title>
<%@ include file="/main/main_css.jsp"%>
<%@ include file="/main/main_js.jsp"%>
</head>
<body>
	<!--  -->
	<div class="all-wrapper">
		<div class="row com-header text-center">
			<span>鹰潭市行政服务中心</span>
		</div>
		<div class="row main-content file-upload">
			<div class="row">
				<div class="time-count pull-right">
					<span>剩余</span> <span id="time" class="text-red"></span> <span>秒</span>
				</div>
			</div>
			<div class="row">
				<h1>附件上传</h1>
			</div>
			<c:forEach var="item" items="${upList }" varStatus="status">

				<div class="row el">
					<div class="col-md-12">
						<span class="list-name" style="font-size:22px">${item.CLNAME }</span>
					</div>

					<div class="col-md-12">
						<c:if test="${empty imgMap}">
							<label class="pull-right btn btn-warning btn-lg btn-custom-lg">
								<span><a
									href="takePhoto?itemId=${itemId }&fielName=${item.CLNAME }&id=${item.ID}&currentPage=${currentPage}">上传材料</a></span>
							</label>
						</c:if>
					</div>

					<c:if test="${!empty imgMap}">
						<c:if test="${imgMap.containsKey(item.ID)== true}">
							<button
								class="pull-right btn btn-warning btn-lg btn-custom-lg toggle-show">
								<span class="toshow">展开</span> <span class="tohiden">收起</span>
							</button>
							<a
								href="takePhoto?itemId=${itemId }&fielName=${item.CLNAME }&id=${item.ID}&currentPage=${currentPage}"
								class="pull-right btn btn-modify btn-warning btn-lg btn-custom-lg toggle-show">修改</a>
						</c:if>
						<c:if test="${imgMap.containsKey(item.ID)== false}">
							<div class="col-md-12">
								<label class="pull-right btn btn-warning btn-lg btn-custom-lg">
									<span><a
										href="takePhoto?itemId=${itemId }&fielName=${item.CLNAME }&id=${item.ID}&currentPage=${currentPage}">上传材料</a></span>
								</label>
							</div>
						</c:if>


						<div class="col-md-24 pic-view">
							<div class="swiper-container-a">
								<div class="swiper-wrapper">
									<c:forEach var="imgitem" items="${imgMap}">
										<c:if test="${imgitem.key eq item.ID }">
											<c:forEach var="imglist" items="${imgitem.value }">
												<div class="swiper-slide red-slide">
													<div class="title">
														<div class="imgage-wrapper">
															<img style="height:69px;width:100px;"
																src="data:image/jpeg;base64,${imglist}" alt="">
														</div>
													</div>
												</div>
											</c:forEach>
										</c:if>
									</c:forEach>
								</div>
							</div>
						</div>
					</c:if>
				</div>

			</c:forEach>
		</div>
		<div class="row current-page">
			<div class="pull-right">
				<c:if test="${currentPage>1 }">
					<a class="btn btn-lg btn-warning"
						href="getitemfilelist?itemId=${itemId }&currentPage=${currentPage-1}">上一页</a>
				</c:if>
				<c:if test="${currentPage<=1 }">
					<a class="btn btn-lg btn-warning">上一页</a>
				</c:if>
				<span class="txt-md">${currentPage}/${pageCount }</span>
				<c:if test="${currentPage< pageCount}">
					<a class="btn btn-lg btn-warning" type="button"
						href="getitemfilelist?itemId=${itemId }&currentPage=${currentPage+1}"">下一页</a>
				</c:if>
				<c:if test="${currentPage>= pageCount}">
					<a class="btn btn-lg btn-warning" type="button">下一页</a>
				</c:if>
			</div>
		</div>
		<div class="row footer">
			<a class="btn btn-success btn-lg" href="toindex" role="button"><i
				class="fa fa-reply"></i>返回首页</a>
			<c:if test="${!empty imgMap}">
				<a class="btn btn-primary btn-lg" id="up-load" role="button">提交<i
					class="fa fa-hand-pointer-o"></i></a>
			</c:if>
			<c:if test="${empty imgMap}">
				<a class="btn btn-primary btn-lg"
					onclick="javascript:history.go(-1)" role="button">上一步<i
					class="fa fa-hand-pointer-o"></i></a>
			</c:if>
		</div>
	</div>
	<!--  -->
	<form id="loginOut" action="loginOut"></form>
	<script>
	//页面加载动画
	var index = layer.load(3, {
    shade: [0.3,'#000'] //0.1透明度的白色背景  
	});
	setTimeout(function(){
	    layer.close(index);
	},500);
	
	//加入倒计时
    	var count =  119;
        function countdown(){
        	$("#time").text(count);
        	if(count > 0){
        		window.setTimeout("countdown()",1000);
        		count --;
        	}else{
        		$("#loginOut").submit();
        	}
        }
        countdown();
    
        $(document).on('click','.toggle-show',function(){
            $(this).closest('.el').toggleClass('toggle-active')
            .find('.pic-view').slideToggle();
           
        });
        var mySwiper = new Swiper('.swiper-container-a',{
            loop:false,
            grabCursor: true,
            slidesPerView: 3
        })
        
	    //提交
	   $('#up-load').on('click',function(){
		   if(${imgMap.size()==nameAndIdMap.size() }){
			   $(this).attr("href","uploaditemfile?itemid=${itemId }");
			   //$(this).attr('disabled','disabled');
			   var index = layer.load(3, {
				    shade: [0.3,'#000'] //0.1透明度的白色背景  
					});
			   layer.msg('文件上传中,请稍等片刻......', {time:10000}); 
					setTimeout(function(){
					    layer.close(index);
				},10000);
		   }else{
			   layer.alert("请拍完所有材料后提交");
		   }
	       
	   });
        
        var winH = $(document).height();
        var mainH = winH -205;
        $('.main-content').height(mainH);
    </script>
</body>
</html>